<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->


    <link href="__ADMIN_TMPL__/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMIN_TMPL__/public/assets/simpleboot3/css/simplebootadmin.css" rel="stylesheet">
    <link href="__ADMIN_TMPL__/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        form .input-order {
            margin-bottom: 0px;
            padding: 0 2px;
            width: 42px;
            font-size: 12px;
        }

        form .input-order:focus {
            outline: none;
        }

        .table-actions {
            margin-top: 5px;
            margin-bottom: 5px;
            padding: 0px;
        }

        .table-list {
            margin-bottom: 0px;
        }

        .form-required {
            color: red;
        }
    </style>
    <script type="text/javascript">
        //全局变量
        var GV = {
            ROOT: "__ROOT__/",
            WEB_ROOT: "__WEB_ROOT__/",
            JS_ROOT: "static/js/",
            APP: '{$Request.module}'/*当前应用名*/
        };
    </script>
    <script src="__ADMIN_TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>
    <script src="__STATIC__/js/wind.js"></script>
    <script src="__ADMIN_TMPL__/public/assets/js/bootstrap.min.js"></script>
    <script>
        Wind.css('artDialog');
        Wind.css('layer');
        $(function () {
            $("[data-toggle='tooltip']").tooltip({
                container:'body',
                html:true,
            });
            $("li.dropdown").hover(function () {
                $(this).addClass("open");
            }, function () {
                $(this).removeClass("open");
            });
        });
    </script>
    <if condition="APP_DEBUG">
        <style>
            #think_page_trace_open {
                z-index: 9999;
            }
        </style>
    </if>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:cmf_plugin_url('JxhgDb://AdminIndex/index')}">会员列表</a></li>
        <li class="active"><a href="{:cmf_plugin_url('JxhgDb://AdminIndex/editjf')}">调节积分</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20"
          action="{:cmf_plugin_url('JxhgDb://AdminIndex/editjf')}">
        <input type="hidden" name="user_name" value="{$info.user_name}">
        <div class="form-group">
            <label class="col-sm-2 control-label">户名</label>
            <div class="col-md-6 col-sm-10">
                <input type="hidden" name="user_id" value="{$info.user_id}">
                <input type="text" class="form-control" value="{$info.user_name}" disabled>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required">*</span>变动原因</label>
            <div class="col-md-6 col-sm-10">
                <textarea rows="5" class="form-control" name="remark" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">类型</label>
            <div class="col-md-6 col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="type" value="1" checked>增加
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" value="2" onclick="jf1(this)" >扣除
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required" >*</span>积分</label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control" name="num" required min="1" oninput="jf(this)">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="form-required"></span>当前积分</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="integral" value="{$info.integral}" readonly>
            </div>
        </div>
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button>
        </div>
    </form>
</div>
</body>
<script>
    function jf(a) {
        var type = $("input[name='type']:checked").val();
        console.log(type);
        console.log($("[name='integral']").val());
        console.log($(a).val());
        if (type==2 && $("[name='integral']").val()<$(a).val()) {
            $(a).val({$info.integral});
        }
    }
    function jf1(a) {
        var type = $(a).val();
        console.log(type);
        console.log($("[name='integral']").val());
        console.log($(a).val());
        if (type==2 && $("[name='integral']").val()<$("[name='num']").val()) {
            $("[name='num']").val(0);
        }
    }
</script>
</html>